/*
Copyright (c) 2010 Andreas Bjerkeholt
License: MIT
http://www.opensource.org/licenses/mit-license.php
*/
#include "gamefield.h"

uint8_t  tilesLayer1[1024];
uint8_t  tilesLayer2[1024];

int8_t   tileOffsetX = 0;
int8_t   tileOffsetY = 0;
uint8_t  tileFieldOffsetX = 12;
uint8_t  tileFieldOffsetY = 12;
uint8_t  tilesVisibleWidth = 9;
uint8_t  tilesVisibleHeight = 9;

uint8_t getTile(uint8_t x, uint8_t y, uint8_t layer)
{
	if (layer == 1)
		return tilesLayer1[x + y * LEVELSIZE];

	if (layer == 2)
		return tilesLayer2[x + y * LEVELSIZE];

	return 0x00;
}

void setTile(uint8_t x, uint8_t y, uint8_t layer, uint8_t tile)
{
	if (layer == 1)
		tilesLayer1[x + y * LEVELSIZE] = tile;

	if (layer == 2)
		tilesLayer2[x + y * LEVELSIZE] = tile;
}
